import { baseWebRouter, rule } from '../../src';

export default baseWebRouter({
  prefix: '/demo1',
  routes() {
    this
      .get('/')
      .docs({
        description: 'Get Demo1',
        category: 'Demo1',
      });

    this
      .get('/users')
      .query({
        page: rule.number.default(1).docs({
          name: 'Page',
          description: 'Current page number',
        }),
        size: rule.number.default(10).docs({
          name: 'Size',
          description: 'Current page size',
        }),
      })
      .action(() => {})
      .docs({
        description: 'Get demo1 users',
        category: 'Demo1',
        remark: 'Here is remark',
      });
  }
});

export const router2 = baseWebRouter({
  routes() {
    this
      .post('/user')
      .body({
        id: rule.number,
      });

    this
      .put('/user/:id')
      .body({
        name: rule.string,
      })
      .params({
        id: rule.number,
      });
  },
});
